﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.StorageClient;
using Microsoft.WindowsAzure;

namespace Work
{
    public class WorkDataServiceContext : TableServiceContext
    {
        public WorkDataServiceContext(string baseAddress, StorageCredentials credentials)
            : base(baseAddress, credentials)
        {
        }

        public IQueryable<WorkItem> WorkItems
        {
            get
            {
                return this.CreateQuery<WorkItem>("WorkItems");
            }
        }

        public void AddMessage(string sender)
        {
            WorkItem wi = new WorkItem();
            wi.Sender = sender;
            this.AddObject("WorkItems", wi);
            this.SaveChanges();
        }
    }
}
